export default {
  methods: {
    /**
     * 确认框
     * @param {*} message
     * @param {*} confirmText
     * @param {*} cancelText
     * @param {*} distinguishCancelAndClose
     */
    confirmHandle(message, confirmText = '预审核通过', cancelText = '撤单', distinguishCancelAndClose = false) {
      return new Promise((resolve, reject) => {
        this.$confirm(message, '提示', {
          confirmButtonText: confirmText,
          cancelButtonText: cancelText,
          distinguishCancelAndClose: distinguishCancelAndClose,
          type: 'warning'
        }).then(() => {
          return resolve(1)
        }).catch(action => {
          return resolve(action === 'cancel' ? 0 : -1)
        })
      })
    },

    /**
 * 确认框提交内容
 * @param {*} message
 * @param {*} confirmText
 * @param {*} cancelText
 */
    proptHandle(message, confirmText, cancelText) {
      return new Promise((resolve, reject) => {
        this.$prompt(message, '提示', {
          confirmButtonText: confirmText,
          cancelButtonText: cancelText
        }).then(({ value }) => {
          return resolve({ action: true, value })
        }).catch(() => {
          return resolve({ action: false })
        })
      })
    }
  }
}
